package com.apps.gomdiem.model;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;

import com.apps.gomdiem.R;


public class UserAccount {
	public static final String TAG = "UserAccount";
	private static UserAccount instance;

	public String mUserName;
	public String _id;
	public String mPassword;
	public String mName;
	public String mAddress;
	public String mEmail;
	public String mPhone;
	public String bankName;
	public String bankNum;
	public String bankBranch;

	public UserAccount() {
	}

	public static UserAccount getInstance(Context ctx) {
		synchronized (TAG) {
			if (instance == null)
				instance = new UserAccount();
			return instance;
		}
	}

	public static void clear() {
		instance = null;
	}

	public List<ProfileItem> genInfo() {
		List<ProfileItem> infos = new ArrayList<ProfileItem>();
		infos.add(new ProfileItem(R.string.info_name, mName));
		infos.add(new ProfileItem(R.string.info_phone, mPhone));
		infos.add(new ProfileItem(R.string.info_email, mEmail));
		infos.add(new ProfileItem(R.string.info_id, _id));
		infos.add(new ProfileItem(R.string.info_address, mAddress));
		infos.add(new ProfileItem(R.string.info_bankname, bankName));
		infos.add(new ProfileItem(R.string.info_banknum, bankNum));
		infos.add(new ProfileItem(R.string.info_bankbranch, bankBranch));
		return infos;
	}

	public static class ProfileItem {
		public int titleId;
		public String value;

		public ProfileItem(int res, String val) {
			titleId = res;
			value = val;
		}
	}
}